var map;
var marker;
function init_map() {
	var myOptions = {
		zoom : 6,
		center : new google.maps.LatLng(36.580247, -231.979981),
		mapTypeId : google.maps.MapTypeId.ROADMAP
	};
	map = new google.maps.Map(document.getElementById("Location"), myOptions);

}
google.maps.event.addDomListener(window, 'load', init_map);

function createMarker(id) {
	var request = $.ajax({
		url : 'device/' + id
		,type : 'GET'
		,dataType : 'json'
	});
	request.done(function(info) {
		marker = new google.maps.Marker({
			map : map,
			position : new google.maps.LatLng(parseInt(info['latitude']), parseInt(info['longitude'])),
			/* draggable:true, // Bounce

			animation: google.maps.Animation.DROP // Bounce */
			});
		var infowindow = new google.maps.InfoWindow({ content: info['name']});

		google.maps.event.addListener(marker, "click", function() {
		infowindow.close(map,marker);
		});
		infowindow.open(map,marker);
	});
	request.fail(function(jqXHR, textStatus) {
		alert('Request failed!');
	});	
//infowindow = new google.maps.InfoWindow({
//	content : maps.getPosition
//});
//google.maps.event.addListener(marker, "click", function() {
//
//	infowindow.open(map, marker);
//});
//infowindow.open(map, marker);
}

function pushMarker() {
	EventBus.dispatch(EventType.ALARM_RECEIVED);
}